
const {insert,update,deleteByIds,select} = require('../service/PersonService.js')

exports.add = function(ctx){
    //console.log('add ctx',ctx)    
    const result = insert(Object.assign({nameSpace:'test',name:'xxxx'},ctx.body))
    return result
}

exports.edit = function({body}){
    //console.log('add ctx',ctx)
    if(!body.id){
        throw new Error('需要id')
    }
    const result = edit(body)
    return result
}

exports.deleteByIds = function({body}){
    //console.log('add ctx',ctx)
    if(!body.ids){
        throw new Error('需要ids')
    }
    const result = deleteByIds(body.ids)
    return result
}

exports.select = function({body}){   
    const result = select(body)
    return result
}

exports.sum = function({body:{num1,num2}}){
    //num1 ,num2
    return num1 + num2
}